<?php
header('Content-type:text/html;charset=utf-8');
 ?>
 <?php
if ($_POST) {
	$num1 = $_POST['num1'];
	$num2 = $_POST['num2'];
	$yunsuan = $_POST['yunsuan'];
	switch ($yunsuan) {
		case '+' :
			$re = $num1 + $num2;
			break;
		case '-' :
			$re = $num1 - $num2;
			break;
		case '*' :
			$re = $num1 * $num2;
			break;
		case '/' :
			$re = $num1 / $num2;
			break;
		default :
			break;
	}
} else {
	$re = 0;
}
  ?>
 <html>
 	<head>
 		<title></title>
 	</head>
 	<body>
 		<h2>结果:<span style="color: red;"><?php echo $re ?></span></h2>
 		<form action="" method="post">
 			数字1：
 			<input type="text" name="num1" value=""/>
 			<br />
 			运算符：
 			<select name="yunsuan">
 				<option value="+">+</option>
 				<option value="-">-</option>
 				<option value="*">*</option>
 				<option value="/">/</option>
 			</select>
 			<br />
 			数字2：
 			<input type="text" name="num2" value="" />
 			<br />
 			<input type="submit" value="计算"/>
 		</form>
 	</body>
 </html>